package com.example.mongodb.mongodb;

import com.example.mongodb.entity.DishesInfo;
import lombok.Data;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import javax.persistence.Id;
import java.util.List;

/**
 * @author : zhayh
 * @date : 2021-5-16 19:49
 * @description :
 */

@Data
@Document(collection = "restaurants")
@CompoundIndexes({
        @CompoundIndex(name = "shopName_dishesType_idx", def = "{'shopName': 1, 'dishesType': -1}")
}) // 1为正序，-1为反序
public class RestaurantDoc {
    @Id
    ObjectId _id;
    Long dataId;
    @Field("shop_name")
    String shopName;
    String shopMemo;
    Integer shopAvgPrice;
    Float shopGrade;
    String shopContact;
    String shopSaleTime;
    String dishesType;
    List<DishesInfo> dishesList;
    List<Double> position;

    // 自建关键字词组
    List<String> keywords;
}
